using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gko.Utils
{
	/// <summary>
	/// The type of access to a file mapping object, which ensures the page protection of the pages.
	/// </summary>
	[Flags]
	public enum FileMappingAccess
	{
		/// <summary>
		/// A copy-on-write view of the file is mapped. The object must have been created with the PAGE_WRITECOPY option. The system commits physical storage from the paging file at the time MapViewOfFileEx is called. The actual physical storage is not used until a thread in the process writes to an address in the view. At that point, the system copies the original page to a new page backed by the paging file, maps the page into the process address space, and changes the page protection to PAGE_READWRITE. The threads in the process can access only this local copy of the data, not the original data. If this page is trimmed from the working set of the process, it can be written to the paging file storage that is committed when MapViewOfFileEx is called. This process only allocates physical memory when a virtual address is actually written to. Changes are never written back to the original file, and are freed when the thread in the process unmaps the view. Paging file space for the entire view is committed when copy-on-write access is specified, because the thread in the process can write to every single page. Therefore, enough physical storage space must be obtained at the time MapViewOfFileEx is called. </summary>
		Copy = 0x0001,
		/// <summary>
		/// A read/write view of the file is mapped. The object must have been created with the PAGE_READWRITE option.
		/// </summary>
		Write = 0x0002,
		/// <summary>
		/// A read-only view of the file is mapped. The object must have been created with the PAGE_READWRITE or PAGE_READONLY option.
		/// </summary>
		Read = 0x0004,
		/// <summary>
		/// An executable view of the file is mapped (mapped memory can be run as code). The object must have been created with the PAGE_EXECUTE_READWRITE or PAGE_EXECUTE_READ option. Windows Server 2003 and Windows XP:  This feature is available starting with Windows XP SP2 and Windows Server 2003 SP1. </summary>
		Execute = 0x0020,
		/// <summary>
		/// Equivalent to specified Write|Read. The object must have been created with the PAGE_READWRITE option.
		/// </summary>
		AllRights = 0x000F001F,
	}
}